import React, { Component } from 'react'

export default class Judge extends Component {
    state = {
        flag: true
    }
    change = () => {
        this.setState({
            flag: !this.state.flag
        })
    }
    render() {
        const { flag } = this.state
        return (
            <div>
                {/* <h2>
                    {
                        flag? '张三': '李四'
                    }
                </h2> */}

                {/* v-show */}
                {/* <h2 className = { flag? 'block': 'none' }>
                    Title
                </h2> */}

                {/* v-if */}
                {/* {
                    flag? <h2>Title</h2>: ''
                } */}
               
                
                
                <button onClick = {() => {
                    this.change()
                }}>修改flag</button>
            </div>
        )
    }
}
